let express = require('express') // express框架
let router = express.Router()
let mysql = require('mysql')
let dbConfig = require('../db')

var connection = mysql.createConnection(dbConfig)
connection.connect()

router.get('/addUserlist', (req, res) => {
  var sql = `insert into user(userId,userName,userAccount,userPassword,userCredit,userCreatetime,payPassword) values (0,?,?,?,?,?,?)`

  var parms = [
      req.query.userName,
      req.query.userAccount,
      req.query.userPassword,
      req.query.userCredit,
      req.query.userCreatetime,
      req.query.userPassword
    ]
  console.log("a",parms)
  connection.query(sql,parms,function (err, result) {
    if (err) {
      console.log(err)
    }
    if (result) {
      console.log(result)
      res.send(result)
    }
  })
})


module.exports = router